package com.wlw.eye.ui.fragment

import android.support.v7.widget.GridLayoutManager
import com.wlw.eye.R
import com.wlw.eye.adapter.FindAdapter
import com.wlw.eye.mvp.contract.FindContract
import com.wlw.eye.mvp.model.bean.FindBean
import com.wlw.eye.mvp.presenter.FindPresenter
import kotlinx.android.synthetic.main.find_fragment.*

class FindFragment : BaseFragment(), FindContract.View {
    private var mList: MutableList<FindBean>? = null
    private var mPresenter: FindPresenter? = null
    private var mAdapter: FindAdapter? = null
    override fun getLayoutResources(): Int = R.layout.find_fragment
    override fun initView() {
        mPresenter = FindPresenter(context, this)
        mPresenter?.start()
        mAdapter = FindAdapter(mList)
        rv_find.layoutManager = GridLayoutManager(context, 2)
        rv_find.adapter = mAdapter
    }

    override fun setData(beans: MutableList<FindBean>) {
        mList = beans
        mAdapter?.list = beans
        mAdapter?.notifyDataSetChanged()
    }
}